package misp_backend.controller;

import misp_backend.config.AjaxResult;
import misp_backend.domain.Package;
import misp_backend.domain.PackageDTO;
import misp_backend.service.PackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/package")
public class PackageController {
    @Autowired
    private PackageService packageService;
    @GetMapping("/listall")
    public AjaxResult listall(){
        return AjaxResult.success(packageService.listall());
    }
    @PostMapping("/add")
    public AjaxResult addPackage(@RequestBody PackageDTO packageDTO){
        return AjaxResult.success(packageService.addnewpackage(packageDTO));
    }
    @GetMapping("/listpackagedetails")
    public AjaxResult listpackagedetails(@RequestParam Long packageid){
        return AjaxResult.success(packageService.listpackdetails(packageid));
    }


}
